package com.example.tv.codelab;

import com.example.google.tv.leftnavbar.LeftNavBar;
import com.example.google.tv.leftnavbar.LeftNavBarService;

import android.app.ActionBar;
import android.app.ActionBar.Tab;
import android.app.FragmentTransaction;

import android.app.Activity;
import android.os.Bundle;

public class VideoSelectionActivity extends Activity {
	
	public String[] mCategories = {"one", "two", "three", "four", "five" };
	public LeftNavBar mBar;
    public static final int[] mIcons = {
            R.drawable.icon01,
            R.drawable.icon02, R.drawable.icon03, R.drawable.icon04, R.drawable.icon05
    };
    
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        mBar = (LeftNavBarService.instance()).getLeftNavBar((Activity) this);
        mBar.setDisplayUseLogoEnabled(true);

        // Note - I'm showing this so that my UI is pushed down a bit and it
        // does a partial reveal
        // on screen. Thus giving the user an indicator that scrolling is
        // possible.

        mBar.setTitle(R.string.app_name);
        mBar.showOptionsMenu(false);
        // If you want to hide the Title, uncomment the line below.
        // mBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
        boolean isfirst = true;
        int iconCounter = mCategories.length - 1;
        for (String name : mCategories) {
	        mBar.addTab(mBar.newTab().setText(name).setIcon(mIcons[iconCounter--])
	                .setTabListener(new ActionBar.TabListener() {
	
	                    @Override
	                    public void onTabUnselected(Tab tab, FragmentTransaction ft) {
	                    }
	
	                    @Override
	                    public void onTabSelected(Tab tab, FragmentTransaction ft) {
	                        //selectCategory(tab.getText().toString());
	                    }
	
	                    @Override
	                    public void onTabReselected(Tab tab, FragmentTransaction ft) {
	
	                    }
	                }), isfirst);
        };
        mBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        
        setContentView(R.layout.main);
    }
}